<script name="compile">
    function templateCompile(data) {
        var defaultData = {
            type: "module",
            routerType: "newNav",
        };
        var newData = Object.assign(defaultData, data);
        var callback = {
            success: true,
            result: newData
        };
        if (newData.routerType == "newNav") {
            if (!newData.title) {
                return {
                    success: false,
                    result: "请输入导航标题"
                };
            }
        }
        if (!newData.routerUrl) {
            return {
                success: false,
                result: "请输入导航url地址,参数名：routerUrl"
            };
        }
        return callback;
    }
</script>
<script name="templateScript">
    <% if (routerType == "page") { %>
        location.href = "<%= routerUrl %>"
    <% } %>
</script>